<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../common/commonPrint.jsp" %>
<%@ page import="java.util.*,com.hz.framework.util.*" %>
<%@page import="com.hz.framework.dao.CommonDBDao,java.net.URLEncoder"%>
<%	
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
	String sql = (String)request.getParameter("sqlprint");
	int row = Integer.parseInt((String)request.getParameter("row"));
	request.setAttribute("listinfo",CommonDBDao.staticList(sql,true));
	response.setHeader("Content-Disposition","attachment; filename="+URLEncoder.encode("客户订单统计表", "UTF-8") + ".xls");
	
%>
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 11">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
x\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><!--[if gte mso 9]><xml>
 <o:DocumentProperties>
  <o:Created>1996-12-17T01:32:42Z</o:Created>
  <o:LastSaved>2011-12-18T09:30:58Z</o:LastSaved>
  <o:Version>11.5606</o:Version>
 </o:DocumentProperties>
 <o:OfficeDocumentSettings>
  <o:RemovePersonalInformation/>
 </o:OfficeDocumentSettings>
</xml><![endif]-->
<style>
<!--table
	{mso-displayed-decimal-separator:"\.";
	mso-displayed-thousand-separator:"\,";}
<%-- 设置页面边距 和 横向  --%>
@page
	{margin:.39in .39in .39in .39in;
	mso-header-margin:.51in;
	mso-footer-margin:.51in;
	mso-page-orientation:landscape;}
tr
	{mso-height-source:auto;
	mso-ruby-visibility:none;}
col
	{mso-width-source:auto;
	mso-ruby-visibility:none;}
br
	{mso-data-placement:same-cell;}
.style0
	{mso-number-format:General;
	text-align:general;
	vertical-align:bottom;
	white-space:nowrap;
	mso-rotate:0;
	mso-background-source:auto;
	mso-pattern:auto;
	color:windowtext;
	font-size:12.0pt;
	font-weight:400;
	font-style:normal;
	text-decoration:none;
	font-family:宋体;
	mso-generic-font-family:auto;
	mso-font-charset:134;
	border:none;
	mso-protection:locked visible;
	mso-style-name:常规;
	mso-style-id:0;}
td
	{mso-style-parent:style0;
	padding:0px;
	mso-ignore:padding;
	color:windowtext;
	font-size:12.0pt;
	font-weight:400;
	font-style:normal;
	text-decoration:none;
	font-family:宋体;
	mso-generic-font-family:auto;
	mso-font-charset:134;
	mso-number-format:General;
	text-align:general;
	vertical-align:bottom;
	border:none;
	mso-background-source:auto;
	mso-pattern:auto;
	mso-protection:locked visible;
	white-space:nowrap;
	mso-rotate:0;}
.xl24
	{mso-style-parent:style0;
	text-align:center;
	vertical-align:middle;
	background:white;
	mso-pattern:auto none;}
.xl25
	{mso-style-parent:style0;
	font-weight:700;
	text-align:center;
	vertical-align:middle;
	background:white;
	mso-pattern:auto none;}
.xl26
	{mso-style-parent:style0;
	color:#003366;
	font-size:9.0pt;
	font-weight:700;
	text-align:center;
	vertical-align:middle;
	border-top:none;
	border-right:.5pt solid windowtext;
	border-bottom:.5pt solid windowtext;
	border-left:none;
	background:silver;
	mso-pattern:auto none;}
.xl27
	{mso-style-parent:style0;
	font-size:9.0pt;
	text-align:center;
	vertical-align:middle;
	border-top:none;
	border-right:.5pt solid windowtext;
	border-bottom:.5pt solid windowtext;
	border-left:.5pt solid windowtext;
	background:white;
	mso-pattern:auto none;
	white-space:normal;}
.xl28
	{mso-style-parent:style0;
	font-size:9.0pt;
	text-align:center;
	vertical-align:middle;
	border-top:none;
	border-right:.5pt solid windowtext;
	border-bottom:.5pt solid windowtext;
	border-left:none;
	background:white;
	mso-pattern:auto none;
	white-space:normal;}
.xl29
	{mso-style-parent:style0;
	text-align:center;
	vertical-align:middle;
	border-top:none;
	border-right:.5pt solid windowtext;
	border-bottom:.5pt solid windowtext;
	border-left:none;
	background:white;
	mso-pattern:auto none;}
.xl30
	{mso-style-parent:style0;
	font-size:26.0pt;
	font-family:华文行楷;
	mso-generic-font-family:auto;
	mso-font-charset:134;
	text-align:center;
	vertical-align:middle;}
.xl31
	{mso-style-parent:style0;
	color:#003366;
	font-size:9.0pt;
	font-weight:700;
	text-align:center;
	vertical-align:middle;
	border-top:none;
	border-right:.5pt solid windowtext;
	border-bottom:.5pt solid windowtext;
	border-left:.5pt solid windowtext;
	background:silver;
	mso-pattern:auto none;}
.xl32
	{mso-style-parent:style0;
	color:#003366;
	font-size:9.0pt;
	font-weight:700;
	text-align:center;
	vertical-align:middle;
	border-top:.5pt solid windowtext;
	border-right:none;
	border-bottom:.5pt solid windowtext;
	border-left:.5pt solid windowtext;
	background:silver;
	mso-pattern:auto none;
	white-space:normal;}
.xl33
	{mso-style-parent:style0;
	color:#003366;
	font-size:9.0pt;
	font-weight:700;
	text-align:center;
	vertical-align:middle;
	border-top:.5pt solid windowtext;
	border-right:.5pt solid windowtext;
	border-bottom:.5pt solid windowtext;
	border-left:none;
	background:silver;
	mso-pattern:auto none;
	white-space:normal;}
.xl34
	{mso-style-parent:style0;
	color:#003366;
	font-size:9.0pt;
	font-weight:700;
	text-align:center;
	vertical-align:middle;
	border-top:.5pt solid windowtext;
	border-right:.5pt solid windowtext;
	border-bottom:none;
	border-left:.5pt solid windowtext;
	background:silver;
	mso-pattern:auto none;}
.xl35
	{mso-style-parent:style0;
	font-size:9.0pt;
	text-align:center;
	vertical-align:middle;
	border:.5pt solid windowtext;
	background:white;
	mso-pattern:auto none;
	white-space:normal;}
ruby
	{ruby-align:left;}
rt
	{color:windowtext;
	font-size:9.0pt;
	font-weight:400;
	font-style:normal;
	text-decoration:none;
	font-family:宋体;
	mso-generic-font-family:auto;
	mso-font-charset:134;
	mso-char-type:none;
	display:none;}
-->
</style>
<!--[if gte mso 9]><xml>
 <x:ExcelWorkbook>
  <x:ExcelWorksheets>
   <x:ExcelWorksheet>
    <x:Name>Sheet1</x:Name>
    <x:WorksheetOptions>
     <x:DefaultRowHeight>285</x:DefaultRowHeight>
     <x:Print>
      <x:ValidPrinterInfo/>
      <x:PaperSizeIndex>9</x:PaperSizeIndex>
      <x:Scale>80</x:Scale><%-- 设置页面打印缩放比例  --%>
      <x:HorizontalResolution>600</x:HorizontalResolution>
      <x:VerticalResolution>600</x:VerticalResolution>
     </x:Print>
     <x:CodeName>Sheet1</x:CodeName>
     <x:Selected/>
     <x:Panes>
      <x:Pane>
       <x:Number>3</x:Number>
       <x:ActiveRow>12</x:ActiveRow>
       <x:ActiveCol>13</x:ActiveCol>
      </x:Pane>
     </x:Panes>
     <x:ProtectContents>False</x:ProtectContents>
     <x:ProtectObjects>False</x:ProtectObjects>
     <x:ProtectScenarios>False</x:ProtectScenarios>
    </x:WorksheetOptions>
   </x:ExcelWorksheet>
  </x:ExcelWorksheets>
  <x:WindowHeight>4530</x:WindowHeight>
  <x:WindowWidth>8505</x:WindowWidth>
  <x:WindowTopX>480</x:WindowTopX>
  <x:WindowTopY>120</x:WindowTopY>
  <x:AcceptLabelsInFormulas/>
  <x:ProtectStructure>False</x:ProtectStructure>
  <x:ProtectWindows>False</x:ProtectWindows>
 </x:ExcelWorkbook>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1"/>
 </o:shapelayout></xml><![endif]-->
</head>

<body link=blue vlink=purple class=xl24 lang=ZH-CN>

<table x:str border=0 cellpadding=0 cellspacing=0 width=1257 style='border-collapse:
 collapse;table-layout:fixed;width:949pt'>
 <col class=xl24 width=72 style='width:54pt'>
 <col class=xl24 width=45 span=24 style='mso-width-source:userset;mso-width-alt:
 1440;width:34pt'>
 <col class=xl24 width=51 style='mso-width-source:userset;mso-width-alt:1632;
 width:38pt'>
 <col class=xl24 width=54 style='mso-width-source:userset;mso-width-alt:1728;
 width:41pt'>
 <tr height=59 style='mso-height-source:userset;height:44.25pt'>
  <td colspan=27 height=59 width=1257 style='height:44.25pt;width:949pt'
  align=left valign=top><!--[if gte vml 1]><v:shapetype id="_x0000_t75"
   coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe"
   filled="f" stroked="f">
   <v:stroke joinstyle="miter"/>
   <v:formulas>
    <v:f eqn="if lineDrawn pixelLineWidth 0"/>
    <v:f eqn="sum @0 1 0"/>
    <v:f eqn="sum 0 0 @1"/>
    <v:f eqn="prod @2 1 2"/>
    <v:f eqn="prod @3 21600 pixelWidth"/>
    <v:f eqn="prod @3 21600 pixelHeight"/>
    <v:f eqn="sum @0 0 1"/>
    <v:f eqn="prod @6 1 2"/>
    <v:f eqn="prod @7 21600 pixelWidth"/>
    <v:f eqn="sum @8 21600 0"/>
    <v:f eqn="prod @7 21600 pixelHeight"/>
    <v:f eqn="sum @10 21600 0"/>
   </v:formulas>
   <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
   <o:lock v:ext="edit" aspectratio="t"/>
  </v:shapetype><v:shape id="_x0000_s1025" type="#_x0000_t75" style='position:absolute;
   margin-left:231pt;margin-top:10.5pt;width:34.5pt;height:27.75pt;z-index:1'>
   <v:imagedata src="<%=basePath %>parts/images/image002.jpg" o:title="logo"/>
  </v:shape><![endif]--><![if !vml]><span style='mso-ignore:vglayout;
  position:absolute;z-index:1;margin-left:308px;margin-top:14px;width:46px;
  height:37px'><img width=46 height=37
  src="<%=basePath %>parts/images/logo.jpg" v:shapes="_x0000_s1025"></span><![endif]><span
  style='mso-ignore:vglayout2'>
  <table cellpadding=0 cellspacing=0>
   <tr>
    <td colspan=27 height=59 class=xl30 width=1257 style='height:44.25pt;
    width:949pt'>好运来彩色印刷客户订单统计表</td>
   </tr>
  </table>
  </span></td>
 </tr>
 <tr class=xl25 height=19 style='height:14.25pt'>
  <td rowspan=2 height=38 class=xl34 style='border-bottom:.5pt solid black;
  height:28.5pt'>客户名称</td>
	<%	for(int i=1;i<=row;i++){ %>
	<td colspan=2 class=xl32 width=90 style='border-right:.5pt solid black;
		border-left:none;width:68pt'><%=i<10?"&nbsp;"+i:i %></td>
	<% 	}%>
  <td colspan=2 class=xl32 width=105 style='border-right:.5pt solid black;
  border-left:none;width:79pt'>总合计</td>
 </tr>
 <tr class=xl25 height=19 style='height:14.25pt'>
<%	for(int i=1;i<=row;i++){ %>
	<td class=xl26>数量</td>
	<td class=xl26>金额</td>
<% 	}%>
  <td class=xl26>总数量</td>
  <td class=xl26>总金额</td>
 </tr>
 <%
List info = (List)request.getAttribute("listinfo");//数据信息
	if(info!=null){
		double[] num = new double[row];
		double[] mon = new double[row];
		for(int i=0;i<info.size();i++){
			Map minfo = (Map)info.get(i);
	%>
 <tr height=19 style='height:14.25pt'>
  <td height=19 class=xl35 width=72 style='height:14.25pt;border-top:none;
  width:54pt'><%=minfo.get("clientName")==null?"":minfo.get("clientName") %></td>
  <%
    double numsum = 0;
    double monsum = 0;
    for(int j=1;j<=row;j++){
    	double numone = minfo.get("num"+j)==null?0:Double.parseDouble((String)minfo.get("num"+j));
    	double monone = minfo.get("mon"+j)==null?0:Double.parseDouble((String)minfo.get("mon"+j));
    	num[j-1] += numone;
    	mon[j-1] += monone;
    	numsum += numone;
    	monsum += monone;
    %>
	<td class=xl28 width=45 style='width:34pt' x:num><%=CommonUtils.formatDouble(3,numone)%></td>
	<td class=xl28 width=45 style='width:34pt' x:num><%=CommonUtils.formatDouble(3,monone)%></td>
	<%} %>
	<td class=xl28 width=54 style='width:41pt' x:num><%=CommonUtils.formatDouble(3,numsum) %></td>
	<td class=xl28 width=54 style='width:41pt' x:num><%=CommonUtils.formatDouble(3,monsum) %></td>
 </tr>
 <% 	} %>
 <tr height=19 style='height:14.25pt'>
  <td height=19 class=xl27 width=72 style='height:14.25pt;width:54pt'>单天合计：</td>
  <%
  double numsum = 0;
  double monsum = 0;
  for(int j=1;j<=row;j++){
	  numsum+=num[j-1];
	  monsum+=mon[j-1];
  %>
  <td class=xl28 x:num><%=CommonUtils.formatDouble(3,num[j-1]) %></td>
  <td class=xl28 x:num><%=CommonUtils.formatDouble(3,mon[j-1]) %></td>
  <%} %>
  <td class=xl28 x:num><%=CommonUtils.formatDouble(3,monsum) %></td>
  <td class=xl28 x:num><%=CommonUtils.formatDouble(3,monsum) %></td>
 </tr>
 <%}%>
 <c:if test="${empty listinfo}">
	<tr>
		<td colspan="<%=row*2+3 %>" align="center">暂时没有您可以浏览的信息</td>
	</tr>
</c:if>
 <![if supportMisalignedColumns]>
 <tr height=0 style='display:none'>
  <td width=72 style='width:54pt'></td>
  <%for(int j=1;j<=row;j++){%>
  <td width=45 style='width:34pt'></td>
  <td width=45 style='width:34pt'></td>
  <%} %>
  <td width=51 style='width:38pt'></td>
  <td width=54 style='width:41pt'></td>
 </tr>
 <![endif]>
</table>

</body>

</html>
